uniform sampler2D Image; // the texture with the scene you want to blur
varying vec2 vTexCoord;
 
 float RGBdistance(vec4 a, vec4 b)
 {
	return sqrt( (a.r-b.r)*(a.r-b.r) +(a.g-b.g)*(a.g-b.g) + (a.b-b.b)*(a.b-b.b));
 }
 
void main(void)
{
   vec4 sum = vec4(0.0);
   float onePixel = 1.0/400.0;
   sum = texture2D(Image, vec2(vTexCoord.x, vTexCoord.y)) ;
   vec4 up = texture2D(Image, vec2(vTexCoord.x, vTexCoord.y+onePixel)) ;
   vec4 down = texture2D(Image, vec2(vTexCoord.x, vTexCoord.y-onePixel)) ;
   vec4 right = texture2D(Image, vec2(vTexCoord.x+onePixel, vTexCoord.y)) ;
   vec4 left = texture2D(Image, vec2(vTexCoord.x-onePixel, vTexCoord.y)) ;
 
 float threshold = 0.04;
	if( RGBdistance(sum,up)<threshold && 
		RGBdistance(sum,down)<threshold &&
		RGBdistance(sum,right)<threshold &&
		RGBdistance(sum,left)<threshold )
		gl_FragColor = sum;
	else 
		gl_FragColor = vec4(1,0,0,1);
		//gl_FragColor = sum;
}